<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Theron: Theron::Receiver Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Theron
   &#160;<span id="projectnumber">6.00.02</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceTheron.html">Theron</a></li><li class="navelem"><a class="el" href="classTheron_1_1Receiver.html">Receiver</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classTheron_1_1Receiver-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Theron::Receiver Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A standalone entity that can accept messages sent by <a class="el" href="classTheron_1_1Actor.html">actors</a>.  
 <a href="classTheron_1_1Receiver.html#details">More...</a></p>

<p><code>#include &lt;Receiver.h&gt;</code></p>
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for Theron::Receiver:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
 <div class="center">
  <img src="classTheron_1_1Receiver.png" usemap="#Theron::Receiver_map" alt=""/>
  <map id="Theron::Receiver_map" name="Theron::Receiver_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af52a34e59cded82445938db098ea9e08"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_af52a34e59cded82445938db098ea9e08.html#af52a34e59cded82445938db098ea9e08">Receiver</a> ()</td></tr>
<tr class="memdesc:af52a34e59cded82445938db098ea9e08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor.  <a href="#af52a34e59cded82445938db098ea9e08">More...</a><br/></td></tr>
<tr class="separator:af52a34e59cded82445938db098ea9e08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1cf977f348a48e9f5c294d70f2c46992"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a1cf977f348a48e9f5c294d70f2c46992.html#a1cf977f348a48e9f5c294d70f2c46992">Receiver</a> (<a class="el" href="classTheron_1_1EndPoint.html">EndPoint</a> &amp;endPoint, const char *const name=0)</td></tr>
<tr class="memdesc:a1cf977f348a48e9f5c294d70f2c46992"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explicit constructor.  <a href="#a1cf977f348a48e9f5c294d70f2c46992">More...</a><br/></td></tr>
<tr class="separator:a1cf977f348a48e9f5c294d70f2c46992"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0495c119f3048947e43a8330225c8d45"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a0495c119f3048947e43a8330225c8d45.html#a0495c119f3048947e43a8330225c8d45">~Receiver</a> ()</td></tr>
<tr class="memdesc:a0495c119f3048947e43a8330225c8d45"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#a0495c119f3048947e43a8330225c8d45">More...</a><br/></td></tr>
<tr class="separator:a0495c119f3048947e43a8330225c8d45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade22428952084fee67865a194ade6df2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classTheron_1_1Address.html">Address</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_ade22428952084fee67865a194ade6df2.html#ade22428952084fee67865a194ade6df2">GetAddress</a> () const </td></tr>
<tr class="memdesc:ade22428952084fee67865a194ade6df2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the unique address of the receiver.  <a href="#ade22428952084fee67865a194ade6df2">More...</a><br/></td></tr>
<tr class="separator:ade22428952084fee67865a194ade6df2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f40851291b164ac7499550fe935431d"><td class="memTemplParams" colspan="2">template&lt;class ClassType , class ValueType &gt; </td></tr>
<tr class="memitem:a5f40851291b164ac7499550fe935431d"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a5f40851291b164ac7499550fe935431d.html#a5f40851291b164ac7499550fe935431d">RegisterHandler</a> (ClassType *const owner, void(ClassType::*handler)(const ValueType &amp;message, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:a5f40851291b164ac7499550fe935431d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a message handler for a specific message type.  <a href="#a5f40851291b164ac7499550fe935431d">More...</a><br/></td></tr>
<tr class="separator:a5f40851291b164ac7499550fe935431d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad10a6893273e6a468c0400d256e4fd38"><td class="memTemplParams" colspan="2">template&lt;class ClassType , class ValueType &gt; </td></tr>
<tr class="memitem:ad10a6893273e6a468c0400d256e4fd38"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_ad10a6893273e6a468c0400d256e4fd38.html#ad10a6893273e6a468c0400d256e4fd38">DeregisterHandler</a> (ClassType *const owner, void(ClassType::*handler)(const ValueType &amp;message, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:ad10a6893273e6a468c0400d256e4fd38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deregisters a previously registered handler.  <a href="#ad10a6893273e6a468c0400d256e4fd38">More...</a><br/></td></tr>
<tr class="separator:ad10a6893273e6a468c0400d256e4fd38"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4cd17c1a51a4f01e66313c2fa0a0de44"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a4cd17c1a51a4f01e66313c2fa0a0de44.html#a4cd17c1a51a4f01e66313c2fa0a0de44">Reset</a> ()</td></tr>
<tr class="memdesc:a4cd17c1a51a4f01e66313c2fa0a0de44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resets to zero the count of messages received but not yet consumed.  <a href="#a4cd17c1a51a4f01e66313c2fa0a0de44">More...</a><br/></td></tr>
<tr class="separator:a4cd17c1a51a4f01e66313c2fa0a0de44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a753087ea4ee8670ae098b4704b4056a4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a753087ea4ee8670ae098b4704b4056a4.html#a753087ea4ee8670ae098b4704b4056a4">Count</a> () const </td></tr>
<tr class="memdesc:a753087ea4ee8670ae098b4704b4056a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of messages received but not yet consumed.  <a href="#a753087ea4ee8670ae098b4704b4056a4">More...</a><br/></td></tr>
<tr class="separator:a753087ea4ee8670ae098b4704b4056a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5dbee36b18e7c0549ba860d93e2265fd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_a5dbee36b18e7c0549ba860d93e2265fd.html#a5dbee36b18e7c0549ba860d93e2265fd">Wait</a> (const <a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a> max=1)</td></tr>
<tr class="memdesc:a5dbee36b18e7c0549ba860d93e2265fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Waits until one or more messages arrive at the receiver.  <a href="#a5dbee36b18e7c0549ba860d93e2265fd">More...</a><br/></td></tr>
<tr class="separator:a5dbee36b18e7c0549ba860d93e2265fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaecc6c19f587eac73103dc16c71a45df"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Receiver_aaecc6c19f587eac73103dc16c71a45df.html#aaecc6c19f587eac73103dc16c71a45df">Consume</a> (const <a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a> max)</td></tr>
<tr class="memdesc:aaecc6c19f587eac73103dc16c71a45df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Consumes any unconsumed messages available on the receiver, up to a specified limit.  <a href="#aaecc6c19f587eac73103dc16c71a45df">More...</a><br/></td></tr>
<tr class="separator:aaecc6c19f587eac73103dc16c71a45df"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A standalone entity that can accept messages sent by <a class="el" href="classTheron_1_1Actor.html">actors</a>. </p>
<p>A receiver can be instantiated in non-actor user code. Each receiver has a unique <a class="el" href="classTheron_1_1Address.html">address</a> not shared by any actor and can receive <a class="el" href="classTheron_1_1Actor_a47c64d58a7a683b34101002989d7de0a.html#a47c64d58a7a683b34101002989d7de0a">messages sent to it by actors</a> (usually in response to <a class="el" href="classTheron_1_1Framework_a2d5f7f6508227d578dfcedf40dc0b9d0.html#a2d5f7f6508227d578dfcedf40dc0b9d0">messages sent to those actors</a> by the non-actor code). The <a class="el" href="classTheron_1_1Receiver.html" title="A standalone entity that can accept messages sent by actors. ">Receiver</a> provides facilities for synchronizing with the arrival of an expected message, as well as for registering message handlers to handle and process messages as they arrive.</p>
<p>Every receiver instantiated in user code is automatically assigned its own unique <a class="el" href="classTheron_1_1Address.html">address</a>, which enables actors to send messages to it, as if it were an actor itself.</p>
<p>A <a class="el" href="classTheron_1_1Receiver.html" title="A standalone entity that can accept messages sent by actors. ">Receiver</a> accepts messages sent to it by other entities, counting how many it has received. It provides methods whereby the thread owning the receiver can query the count of messages received, mark them as consumed, and block to synchronize with the arrival of an expected message indicating that some resource or result has become available.</p>
<p>Receivers also provide the ability to <a class="el" href="classTheron_1_1Receiver_a5f40851291b164ac7499550fe935431d.html#a5f40851291b164ac7499550fe935431d">register message handlers</a> to handle the messages they receive, similar to the handler registration mechanism within actors. This allows the owning thread to register callback-style handler functions. The registered handlers are executed on the arrival of messages of the types for which they are registered. The arrived message is passed to the handler function on execution, allowing it to examine, process, or store its value.</p>
<p>The ability to synchronize with the arrival of messages via <a class="el" href="classTheron_1_1Receiver_a5dbee36b18e7c0549ba860d93e2265fd.html#a5dbee36b18e7c0549ba860d93e2265fd">Receiver::Wait</a> allows calling threads to ensure they examine the results of executed handler functions only after the messages they handle have arrived, and the associated handlers have been executed. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
